package it.polimi.traveldream.entity;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Embeddable;

/**
 * The primary key class for the giftlistelement database table.
 * 
 */
@Embeddable
public class GiftlistElementPK implements Serializable {
	// default serial version id, required for serializable classes.
	private static final long serialVersionUID = 1L;

	@Column(insertable = false, updatable = false, nullable = false)
	private Integer user;

	@Column(insertable = false, updatable = false, nullable = false)
	private Integer cartpackage;

	public GiftlistElementPK() {
	}

	public Integer getUser() {
		return this.user;
	}

	public void setUser(Integer user) {
		this.user = user;
	}

	public Integer getCartpackage() {
		return this.cartpackage;
	}

	public void setCartpackage(Integer cartpackage) {
		this.cartpackage = cartpackage;
	}

	@Override
	public boolean equals(Object other) {
		if (this == other) {
			return true;
		}
		if (!(other instanceof GiftlistElementPK)) {
			return false;
		}
		GiftlistElementPK castOther = (GiftlistElementPK) other;
		return (this.user == castOther.user) && (this.cartpackage == castOther.cartpackage);
	}

	@Override
	public int hashCode() {
		final Integer prime = 31;
		Integer hash = 17;
		hash = hash * prime + this.user;
		hash = hash * prime + this.cartpackage;

		return hash;
	}
}